<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>test</title>
    <script>
      // 呼叫者
      // http://127.0.0.1:3000/test.html#caller
      // 应答者
      // http://127.0.0.1:3000/test.html#callee

      var socket = new WebSocket("ws://127.0.0.1:3000");
      var callType = window.location.href.split("#")[1];
      function sendMsg() {
        var sendMsg = {
          handle: "测试",
          callType: callType
        };
        socket.send(JSON.stringify(sendMsg));
      }
      socket.onmessage = function (event) {
        console.log(event);
      };
    </script>
  </head>
  <body>
    <button onclick="sendMsg()">测试</button>
  </body>
</html>
